package com.soulgame.sms.pay.vo;

import com.soul.sdk.utils.json.KJSONObject;
import com.soulgame.sgsdkproject.sgtool.AmountUtils;

/**
 * @author lch
 * @version Create time：2017-4-1
 * @类说明：
 */
public class VoADMPayParams extends VoPayParams {

	public VoADMPayParams(KJSONObject pSdkParamsJSON) {
		super(pSdkParamsJSON);

	}

	/**
	 * 获取计费点，缺省返回 0
	 * 
	 * @param pProductId
	 * @return
	 */
	public String getPayCode(String pProductId) {
		return super.getPayCode(pProductId, "adm");
	}

	/**
	 * 获取短信发送号码
	 * @param pProductId
	 * @return
	 */
	public String getPhone(String pProductId) {
		String aPhone = "0";

		KJSONObject aADMJson = this.getADMJson(pProductId);
		if (aADMJson != null) {
			aPhone = aADMJson.getString("phone", "0");
		}
		return aPhone;
	}
	
	/**
	 * 爱动漫 最高只有 20元，价格特殊获取
	 */
	@Override
	public String getPayPrice(String pProductId) {
		String aPrice = "0";

		KJSONObject aADMJson = this.getADMJson(pProductId);
		if (aADMJson != null) {
			String fPrice = aADMJson.getString("price", "0");
			// 分转为元
			aPrice = AmountUtils.changeF2Y(fPrice);
		}
		return aPrice;
		
	}

	private KJSONObject getADMJson(String pProductId) {
		KJSONObject aDataJSON = null;
		if (mPayDataJSON != null) {
			KJSONObject productDataJSON = mPayDataJSON.getJSONObject(pProductId);
			if (productDataJSON != null) {
				aDataJSON = productDataJSON.getJSONObject("adm");
			}
		}
		return aDataJSON;
	}
}
